home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F30680_strtakeWhile.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-03-22  |  1.3 KB  |  34 lines

  1. <xsl:stylesheet version="1.0" 
  2.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.  xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
  4. exclude-result-prefixes="xsl msxsl"
  5. >
  6.   <xsl:template name="str-takeWhile">
  7.     <xsl:param name="pStr" select="/.."/>
  8.     <xsl:param name="pController" select="/.."/>
  9.     <xsl:param name="pContollerParam" select="/.."/>
  10.  
  11.     <xsl:if test="not($pController)">
  12.       <xsl:message terminate="yes">[str-takeWhile]Error: pController not specified.</xsl:message>
  13.     </xsl:if>   
  14.     
  15.         <xsl:variable name="vFirstChar" select="substring($pStr, 1, 1)"/>
  16.         <xsl:variable name="vAccept">
  17.           <xsl:apply-templates select="$pController">
  18.             <xsl:with-param name="pChar" select="$vFirstChar"/>
  19.             <xsl:with-param name="pParams" select="$pContollerParam"/>
  20.           </xsl:apply-templates>
  21.         </xsl:variable>
  22.         
  23.         <xsl:if test="string($vAccept)">
  24.            <xsl:value-of select="$vFirstChar"/>
  25.            <xsl:call-template name="str-takeWhile">
  26.               <xsl:with-param name="pStr" select="substring($pStr, 2)" />
  27.               <xsl:with-param name="pController" select="$pController"/>
  28.               <xsl:with-param name="pContollerParam" select="$pContollerParam"/>
  29.            </xsl:call-template>
  30.         </xsl:if>
  31.       
  32.   </xsl:template>
  33.  
  34. </xsl:stylesheet>